﻿using FwProject.Comm.DapperPage;
using Mondol.DapperPoco;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using X.PagedList;

namespace FwProject.PublicService.SqlExec
{
    public interface ISqlExecuter
    {
        int Execute(string sql, params object[] parameters);

        IQueryable<T> FromSqlQuery<T>(string sql, Dictionary<string, object> Params) where T : class, new();

        IQueryable<T> SqlQuery<T>(string sql, params object[] parameters) where T : class, new();

        IList<T> FromDapperSqlQuery<T>(string sql, object Params) where T : class, new();

        Task<IEnumerable<T>> FromDapperAsyncSqlQuery<T>(string sql, object Params) where T : class, new();

        Paged<T> DapperPageDynamicListFromSql<T>(string sql, string where="", int page = 1, int pageSzie = 10, string PrimaryKey = "Id") where T : class, new();
        Task<Paged<T>> DapperPageAsyncDynamicListFromSql<T>(string sql, string where="", int page = 1, int pageSzie = 10, string PrimaryKey = "Id") where T : class, new();

        IPagedList<T> IPagedListDynamicListFromSql<T>(string sql, string where = "", int page = 1, int pageSzie = 10, string PrimaryKey = "Id") where T : class, new();

        Task<IPagedList<T>> IPagedListDynamicListFromSqlAsync<T>(string sql, string where = "", int page = 1, int pageSzie = 10, string PrimaryKey = "Id") where T : class, new();
    }
}
